//
//  SmallDecisionsZxhOrDmxSelecModelViewController.m
//  SmallDecisions
//
//  Created by 李付雄 on 2025/7/25.
//

#import "SmallDecisionsZxhOrDmxSelecModelViewController.h"
#import "SmallDecisionsZxhOrDmxModelCell.h"

@interface SmallDecisionsZxhOrDmxSelecModelViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UITableView *zxhOrDmxSelecModelTableView;
@property (nonatomic, strong) NSArray *zxhOrDmxSelecModelList;
@end

@implementation SmallDecisionsZxhOrDmxSelecModelViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self setZxhOrDmxSelecModelList];
    [self zxhOrDmxSelecModelTableView];
}

- (void)setZxhOrDmxSelecModelList {
    self.zxhOrDmxSelecModelList = @[
        @{@"zxhOrDmxText":@"温和模式",@"zxhOrDmxContent":@"最经典休闲的模式，适合绝大多数人的聚会。",@"zxhOrDmxIcon":@"samll_deci_fxq_style_one_icon"},
        @{@"zxhOrDmxText":@"刺激模式",@"zxhOrDmxContent":@"时尚而狂野的模式，让派对瞬间火热起来。",@"zxhOrDmxIcon":@"samll_deci_fxq_style_two_icon"},
        @{@"zxhOrDmxText":@"热辣模式",@"zxhOrDmxContent":@"火辣而敏感的模式，未成年人禁止进入。",@"zxhOrDmxIcon":@"samll_deci_fxq_style_three_icon"},
        @{@"zxhOrDmxText":@"混合模式",@"zxhOrDmxContent":@"所有的话题和挑战随机出现，让你一次体验够。",@"zxhOrDmxIcon":@"samll_deci_fxq_style_four_icon"}
    ];
}

- (UITableView *)zxhOrDmxSelecModelTableView {
    if (!_zxhOrDmxSelecModelTableView) {
        _zxhOrDmxSelecModelTableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
        _zxhOrDmxSelecModelTableView.delegate   = self;
        _zxhOrDmxSelecModelTableView.dataSource = self;
        _zxhOrDmxSelecModelTableView.scrollEnabled = NO;
        _zxhOrDmxSelecModelTableView.backgroundColor = [UIColor clearColor];
        [self.view addSubview:_zxhOrDmxSelecModelTableView];
        _zxhOrDmxSelecModelTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        [_zxhOrDmxSelecModelTableView registerClass:[SmallDecisionsZxhOrDmxModelCell class] forCellReuseIdentifier:@"SmallDecisionsZxhOrDmxModelCellId"];
        [_zxhOrDmxSelecModelTableView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.mas_equalTo(0);
            make.height.mas_equalTo(400);
            make.top.mas_equalTo(5);
        }];
    }
    return _zxhOrDmxSelecModelTableView;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.zxhOrDmxSelecModelList.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView
         cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    SmallDecisionsZxhOrDmxModelCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SmallDecisionsZxhOrDmxModelCellId" forIndexPath:indexPath];
    cell.modelParams = self.zxhOrDmxSelecModelList[indexPath.row];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if(self.callback) {
        NSDictionary *modelParams = self.zxhOrDmxSelecModelList[indexPath.row];
        self.callback(modelParams[@"zxhOrDmxText"]);
    }
    [SmallDecisionsNavigatorManager dismissViewControllerAnimated:YES completion:nil];
}

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
    return  [[UIView alloc] init];
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    return  0.0001f;
}

- (BOOL)showNavBarCloseButton {
    return YES;
}

@end
